import request from './request';

/**
  * @author: 志勇
  * @Description: 获取主页轮播图的接口
  * url: /mall-api/index/findBanner
  * @param 
  */

export const findBanner = () => {
  return request({
    url: '/mall-api/index/findBanner'
  })
}

/**
  * @author: 志勇
  * @Description: 获取主页导航分类的数据
  * url: /mall-api/index/findCategory1
  * @param 
  */
export const findCategory1 = () => {
  return request({
    url: '/mall-api/index/findCategory1'
  })
}


/**
  * @author: 志勇
  * @Description: 获取猜你喜欢的数据
  * url: /mall-api/index/findListGoods
  * @param 
  */
export const findListGoods = () => {
  return request({
    url: '/mall-api/index/findListGoods'
  })
}


/**
  * @author: 志勇
  * @Description: 获取主页人气推荐的数据
  * url: /mall-api/index/findRecommendGoods
  * @param 
  */
export const findRecommendGoods = () => {
  return request({
    url: '/mall-api/index/findRecommendGoods'
  })
}


/* ------------------------------ 分类页 ------------------------------------- */
/**
  * @author: 志勇
  * @Description: 获取分类页左侧导航数据
  * url: /mall-api/index/findCategoryTree
  * @param 
  */

export const findCategoryTree = () => {
  return request({
    url: '/mall-api/index/findCategoryTree'
  })
}

/* ------------------------------ 商品相关 ------------------------------------- */
/**
  * @author: 志勇
  * @Description: 获取商品列表的数据
  * url: /mall-api/goods/list/{page}/{limit}
  * @param 
  */
export const findGoodList = (params) => {
  return request({
    url: `/mall-api/goods/list/${params.page}/${params.limit}`,
    data: params
  })
}


// route.get('/mall-api/goods/list', (req, res) => {
//   let {page, limit} = req.query;

//   if(page && limit){

//   }else {
//     res.send({
//       code: 201,
//       msg: '缺失必要的参数'
//     })
//   }
// })